#include "alarm_record.h"

AlarmRecord::AlarmRecord(int64_t id, int status,
                         int64_t alarm_rule_id, int64_t substation_id, int64_t point_id, double max_threshold,
                         int64_t create_at, int64_t update_at)
    : id_(id), status_(status), alarm_rule_id_(alarm_rule_id), substation_id_(substation_id),
      point_id_(point_id), max_threshold_(max_threshold), create_at_(create_at), update_at_(update_at)
{
}

AlarmRecord::~AlarmRecord()
{
    if (state_info_)
    {
        delete state_info_;
        state_info_ = nullptr;
    }
    if (alarm_rule_)
    {
        delete alarm_rule_;
        alarm_rule_ = nullptr;
    }
}

int64_t AlarmRecord::id() const
{
    return id_;
}

int AlarmRecord::status() const
{
    return status_;
}

int64_t AlarmRecord::alarm_rule_id() const
{
    return alarm_rule_id_;
}

int64_t AlarmRecord::substation_id() const
{
    return substation_id_;
}

int64_t AlarmRecord::point_id() const
{
    return point_id_;
}

double AlarmRecord::max_threshold() const
{
    return max_threshold_;
}

int64_t AlarmRecord::create_at() const
{
    return create_at_;
}

int64_t AlarmRecord::update_at() const
{
    return update_at_;
}

void AlarmRecord::set_alarm_rule(AlarmRule *alarm_rule)
{
    alarm_rule_ = alarm_rule;
}

AlarmRule *AlarmRecord::alarm_rule() const
{
    return alarm_rule_;
}

void AlarmRecord::set_state_info(StateInfo *state_info)
{
    state_info_ = state_info;
}

StateInfo *AlarmRecord::state_info() const
{
    return state_info_;
}

int AlarmRecord::point_address() const
{
    return point_address_;
}

void AlarmRecord::set_point_address(int point_address)
{
    point_address_ = point_address;
}